import mediaLibrary from '@ohos.multimedia.mediaLibrary';
export default {
    data: {
        title: 'World'
    },
    getMediaLibrary(){
        var mediaLibraryInstance = mediaLibrary.getMediaLibrary();
        console.log(mediaLibraryInstance)
    },
//    该方法无法展示
    storeMediaAsset(type){
        console.log(type)
        var mediaLibrary = mediaLibrary.getMediaLibrary();
        let option = {
            src : "imageUri_1",
            mimeType : "image/jpeg",
            relativePath : "subDir"
        };
        if(type==='callback'){

            mediaLibrary.getMediaLibrary().storeMediaAsset(option, (err, value) => {
                if (err) {
                    console.log("store media error");
                    return;
                }
                console.log("store media success");
                // get media store uri value
            });
        }else{
            mediaLibrary.getMediaLibrary().storeMediaAsset(option).then((value) => {
                console.log("store media success");
                // get media store uri value
            }).catch((err) => {
                console.log("store media error");
            });
        }
    }
}
  